#ifndef SKYID_READER_H
#define SKYID_READER_H

#include <cstdio>
#include <minizip/unzip.h>

#include "common.h"
#include "object.h"

namespace SkyID
{

class Reader : public Object
{
public:
	Reader(): mSize(0) { }
	virtual ~Reader() { }

	virtual uint32 read(void* buffer, uint32 size) { return 0; }
	virtual uint32 tell() const { return 0; }
	virtual bool reset() { return false; }

	uint32 size() const { return mSize; }

protected:
	uint32 mSize;
};

class ReaderFile : public Reader
{
public:
	ReaderFile(const char* fileName);
	~ReaderFile();

	uint32 read(void* buffer, uint32 size);
	uint32 tell() const;
	bool reset();

private:
	FILE *mFile;
};

class ReaderZip : public Reader
{
public:
	ReaderZip(const char* archiveName, const char* fileName);
	~ReaderZip();

	uint32 read(void* buffer, uint32 size);
	uint32 tell() const;
	bool reset();

private:
	unzFile mFile;
};

} // namespace SkyID

#endif // SKYID_READER_H
